<html>
<head>
	<script>
	function onClick()
	{
		var example = "example";
		var output = document.getElementById('output');
		for (var i = example.length - 1; i >= 0 ; i--) {				
			var text = document.createTextNode(example[i]);
			output.appendChild(text);			
		};
	};
	</script>
</head>
<body>	
	<p>Reverse the word "example"</p>
	<pre>
	function onClick()
	{
		var example = "example";
		var output = document.getElementById('output');
		for (var i = example.length - 1; i >= 0 ; i--) {				
			var text = document.createTextNode(example[i]);
			output.appendChild(text);			
		};
	};
	</pre>
	<button  onclick="onClick()" id="buttonOne">Reverse</button>
	<p>Output</p>
	<div id="output"></div>
</body>
</html>